package com.avic.rong.activity.no;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.avic.rong.R;
import com.example.minato.minastore.utils.AppUtils;
import com.github.lzyzsd.jsbridge.BridgeHandler;
import com.github.lzyzsd.jsbridge.BridgeWebView;
import com.github.lzyzsd.jsbridge.CallBackFunction;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ForgetPwdActivity extends AppCompatActivity {


    public static String ARG_URL = "arg_url";

    @BindView(R.id.webview)
    BridgeWebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forget_pwdl);
        ButterKnife.bind(this);


        String url = null;
        if (getIntent() != null){
            url = getIntent().getStringExtra(ARG_URL);
        }

//        webView.clearCache(true);
//        webView.clearHistory();
//        webView.getSettings().setDomStorageEnabled(true);
//        WebSettings webSettings = webView.getSettings();
//        webSettings.setCacheMode();

//        if (!TextUtils.isEmpty(url)) {
//            webView.loadUrl(url);
//        }
        webView.loadUrl(AppUtils.BASE_URL + "app/forgetPwd");

        webView.registerHandler("forgetSuccess", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                finish();
            }
        });

        webView.registerHandler("goBack", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                finish();
            }
        });

    }


    public static Intent queryIntent(Context context){
        Intent intent = new Intent(context,ForgetPwdActivity.class);
        return intent;
    }
}
